package dy.com.part1.chapter2;

public class DaemonThread {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(()->{
           while(true){
               try{
                   Thread.sleep(500);
                   System.out.println("i am thread");
               }catch (InterruptedException e){
                   e.printStackTrace();
               }
           }
        });
        thread.setDaemon(true);
        thread.start();
        Thread.sleep(2_000L);
        System.out.println("Main Thread finished");
    }
}
